package com.xongxong.admin.web.controller;

import com.xongxong.admin.service.CodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

@Slf4j
@RestController
@RequestMapping("/code")
public class CodeController {
    @Resource
    private CodeService codeService;

    @GetMapping("/save/{codeKey}")
    public String save(@PathVariable("codeKey") String codeKey) throws IOException {
        return   codeService.saveCode(codeKey);
    }


    @GetMapping("/captcha/{codeKey}/{codeValue}")
    public Boolean captcha(@PathVariable("codeKey") String codeKey,@PathVariable("codeValue") String codeValue)  {
        return   codeService.captcha(codeKey,codeValue);
    }


}
